//
//  CalculateLoanMessageTableCell.m
//  YiJuZhangShou
//
//  Created by URANUS on 16/3/18.
//  Copyright © 2016年 Uranus. All rights reserved.
//

#import "CalculateLoanMessageTableCell.h"
#import "UITableViewCell+Custom.h"
#import "CalculateLoanMessageModel.h"
#import "Masonry.h"
@interface CalculateLoanMessageTableCell()
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *detailTitleLabel;
@end

@implementation CalculateLoanMessageTableCell

#pragma mark Initialize
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupConstraints];
        self.backgroundColor = BackgroundColor240;
    }
    return self;
}

#pragma mark Private
- (void)setupConstraints{
   [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       make.left.equalTo(self.contentView).offset(FifteenoffsetViewMargin);
       make.centerY.equalTo(self.contentView);
       make.height.mas_equalTo(ScreenHeight*0.05);
       make.top.bottom.equalTo(self.contentView);
   }];
    
    [self.detailTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).offset(-FifteenoffsetViewMargin);
        make.height.mas_equalTo(ScreenHeight*0.05);
        make.top.bottom.equalTo(self.contentView);
    }];

}

#pragma mark Getter
- (UILabel *)titleLabel{

    if (_titleLabel == nil) {
        _titleLabel = [UILabel new];
        _titleLabel.font = TextFont14;
        _titleLabel.textColor = TextColor120;
        [self.contentView addSubview:_titleLabel];
    }
    return _titleLabel;
}

- (UILabel *)detailTitleLabel{

    if (_detailTitleLabel == nil) {
        _detailTitleLabel = [UILabel new];
        _detailTitleLabel.font = TextFont14;
        _detailTitleLabel.textColor = TextColor80;
        [self.contentView addSubview:_detailTitleLabel];
    }
    return _detailTitleLabel;
}

#pragma mark Setter
-(void)setModel:(CalculateLoanMessageModel *)model{
    self.titleLabel.text = model.title;
    self.detailTitleLabel.text = model.detailTitle;
}

@end
